#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys
from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QVBoxLayout,QLabel, QPushButton, QApplication)
from PyQt5.QtGui import QFont    
import tushare as ts
 
 
class Example(QWidget):
    
    def __init__(self):
        super().__init__()
        
        self.initUI()
        
        
    def initUI(self):

        df = ts.get_index()
        
        lbl1 = QLabel(df.name[0], self)
        lbl1.move(15, 10)
 
        lbl2 = QLabel(str(df.change[0]), self)
        lbl2.move(15, 40)

        lbl3 = QLabel(str(df.close[0]), self)
        lbl3.move(15, 60)

        okButton = QPushButton("OK")
        cancelButton = QPushButton("Cancel")
 
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(okButton)
        hbox.addWidget(cancelButton)
 
        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addLayout(hbox)
        
        self.setLayout(vbox)    
        
        self.setGeometry(300, 300, 300, 150)
        self.setWindowTitle('Buttons')    
        self.show()
        
        
if __name__ == '__main__':
    
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
